Skip to content

Add retry around wclayer operations for process isolated containers - #1091

Merged
Danny Canter (dcantah) merged 1 commit into
microsoft:masterfrom
dcantah:retry-layerops
Aug 6, 2021
Merged

Add retry around wclayer operations for process isolated containers#1091
Danny Canter (dcantah) merged 1 commit into
microsoft:masterfrom
dcantah:retry-layerops

Conversation

@dcantah

Copy link
Copy Markdown
Contributor

This change adds a simple retry loop to handle some behavior on RS5. Loopback VHDs
used to be mounted in a different manor on RS5 (ws2019) which led to some
very odd cases where things would succeed when they shouldn't have, or we'd simply
timeout if an operation took too long. Many parallel invocations of this code path
and stressing the machine seem to bring out the issues, but all of the possible failure
paths that bring about the errors we have observed aren't known.

On 19h1+ this retry loop shouldn't be needed, but the logic is to leave the loop if everything succeeded so this is harmless
and shouldn't need a version check.

Signed-off-by: Daniel Canter dcanter@microsoft.com

@dcantah
Danny Canter (dcantah) requested a review from a team as a code owner August 2, 2021 23:47
@dcantah
Danny Canter (dcantah) force-pushed the retry-layerops branch 2 times, most recently from e0edb8f to 0df4d76 Compare August 2, 2021 23:54
@dcantah

Copy link
Copy Markdown
Contributor Author

Should hopefully help #919

@dcantah

Copy link
Copy Markdown
Contributor Author

Scott Brender (@msscotb) I did when trying to get the PrepareLayer issue to reproduce 😆 I got ERROR_DEVICE_NOT_CONNECTED

@dcantah

Copy link
Copy Markdown
Contributor Author

Scott Brender (@msscotb) Any other feedback for this?

This change adds a simple retry loop to handle some behavior on RS5. Loopback VHDs
used to be mounted in a different manor on RS5 (ws2019) which led to some
very odd cases where things would succeed when they shouldn't have, or we'd simply
timeout if an operation took too long. Many parallel invocations of this code path
and stressing the machine seem to bring out the issues, but all of the possible failure
paths that bring about the errors we have observed aren't known.

On 19h1+ this retry loop shouldn't be needed, but the logic is to leave the loop if everything succeeded so this is harmless
and shouldn't need a version check.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
Comment thread internal/layers/layers.go
}

defer func() {
if err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't err need to be set to PrepareLayer result for the deferred DeactivateLayer to execute?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, if you have a named return value, e.g. (err error) then the return value of line 107 or the PrepareLayer call will get assigned to err after completion. So when defer runs it will have the return value of PrepareLayer to check against.

Here's a quick example: https://play.golang.org/p/cID3RHPwl88

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@AbelHu

Copy link
Copy Markdown

Danny Canter (@dcantah) Scott Brender (@msscotb) Will this fix be included in moby? We have seen this failure in docker many times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContainerCannotRun: hcsshim::PrepareLayer - failed failed in Win32: The device is not ready. (0x15)

4 participants